package com.arcaneshift.security.errors;

import com.common.security.abstracts.AbstractError;

/**
 * @Latest
 * Error code range: 181 - 200
 * 
 * @author Ady
 *
 */
public class DeckError extends AbstractError {
	
	public static final int NO_NAME_PROVIDED = 181;
	private static final String MESSAGE_NO_NAME_PROVIDED = "The deck name was not provided.";
	private static final String CAUSE_NO_NAME_PROVIDED = "The deck had no value tag or the name was empty";
	private static final String DESCRIPTION_NO_NAME_PROVIDED = "Check if the tag is there and make sure it's not empty";
	
	public static final int NAME_BAD_FORMAT = 182;
	private static final String MESSAGE_NAME_BAD_FORMAT = "The provided name was in a bad format";
	private static final String CAUSE_NAME_BAD_FORMAT = "The name was too long, too short or had forbidden characterers";
	private static final String DESCRIPTION_NAME_BAD_FORMAT = "make sure the name is between the bounds and only uses valid characters";
	
	public static final int EMPTY_DECK = 183;
	private static final String MESSAGE_EMPTY_DECK = "The deck had no cards";
	private static final String CAUSE_EMPTY_DECK = "No card tags was provided";
	private static final String DESCRIPTION_EMPTY_DECK = "Add the card tags in the deck tag";
	
	public static final int DECK_NOT_FOUND = 184;
	private static final String MESSAGE_DECK_NOT_FOUND = "There is no deck with the provided data";
	private static final String CAUSE_DECK_NOT_FOUND = "The deck may have been deleted or it failed to save";
	private static final String DESCRIPTION_DECK_NOT_FOUND = "Please check the name of your deck and try again";
	
	public static final int MULTIPLE_DECKS_FOUND = 185;
	private static final String MESSAGE_MULTIPLE_DECKS_FOUND = "";
	private static final String CAUSE_MULTIPLE_DECKS_FOUND = "";
	private static final String DESCRIPTION_MULTIPLE_DECKS_FOUND = "";
	
	public static final int DECK_EXISTS = 186;
	private static final String MESSAGE_DECK_EXISTS = "A deck with the provided data was already found in the system";
	private static final String CAUSE_DECK_EXISTS = "A deck with this name may have been saved by mistake in the database";
	private static final String DESCRIPTION_DECK_EXISTS = "Change the name of the deck or delete/update the other deck";
	
	public DeckError(int code) {
		super(code);
		
		switch(code) {
			case NO_NAME_PROVIDED: {
				setMessage(MESSAGE_NO_NAME_PROVIDED);
				setCause(CAUSE_NO_NAME_PROVIDED);
				setDescription(DESCRIPTION_NO_NAME_PROVIDED);
				break;
			}
			case NAME_BAD_FORMAT: {
				setMessage(MESSAGE_NAME_BAD_FORMAT);
				setCause(CAUSE_NAME_BAD_FORMAT);
				setDescription(DESCRIPTION_NAME_BAD_FORMAT);
				break;
			}
			case EMPTY_DECK: {
				setMessage(MESSAGE_EMPTY_DECK);
				setCause(CAUSE_EMPTY_DECK);
				setDescription(DESCRIPTION_EMPTY_DECK);
				break;
			}
			case DECK_NOT_FOUND: {
				setMessage(MESSAGE_DECK_NOT_FOUND);
				setCause(CAUSE_DECK_NOT_FOUND);
				setDescription(DESCRIPTION_DECK_NOT_FOUND);
				break;
			}
			case MULTIPLE_DECKS_FOUND: {
				setMessage(MESSAGE_MULTIPLE_DECKS_FOUND);
				setCause(CAUSE_MULTIPLE_DECKS_FOUND);
				setDescription(DESCRIPTION_MULTIPLE_DECKS_FOUND);
				break;
			}
			case DECK_EXISTS: {
				setMessage(MESSAGE_DECK_EXISTS);
				setCause(CAUSE_DECK_EXISTS);
				setDescription(DESCRIPTION_DECK_EXISTS);
				break;
			}
		}
	}

}
